import { NavBar, Space, Toast } from "antd-mobile";
import React, { useState, useEffect } from "react";
import TabFen1 from "./compoent/TabFen";
import { useNavigate, useParams } from "react-router-dom";
import { Grid, Image } from "react-vant";
import { detail } from "./sevice/postQuery";
import { Tabs } from "react-vant";
export default function () {
  const navigate = useNavigate();
  const { postId } = useParams();//postid 
  
  let [list, setList] = useState(); //是对象,注意
  useEffect(() => {
    (async () => {
      let list = await detail(postId);
      console.log(list, "啦啦");
      setList(list?.data.data);

      // setList(detail.data.data);
    })();
  }, []);
  useEffect(() => {
    (() => {
      console.log(list, "李广");
    })();
  }, [list]);
  return (
    <div>
      <NavBar
        onBack={() => {
          navigate("/post");
        }}
      >
        {list?.name}
      </NavBar>
      <Image src={"/api" + list?.imgUrl} />

      <TabFen1 list={list} postId={postId} ></TabFen1>
    </div>
  );
}
